home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / rjs.lha / RJS / String / tests / qtest1.C < prev    next >
C/C++ Source or Header  |  1991-06-14  |  1KB  |  49 lines

  1. #include <iostream.h>
  2. #include <ctype.h>
  3.  
  4. #include "RJS/String.h"
  5.  
  6. void main() 
  7. {
  8. // String::set_hunksize(1);
  9. String s1;
  10.  
  11. cout << "Enter string: ";
  12. cin >> s1;
  13.  
  14. StringScan word(s1,StringScan::ByMatch,SSword);
  15. String w;
  16.  
  17. while(word(w)) cout << '$' << w << '$' << endl;
  18.  
  19. s1="hello there world";
  20. StringSearch ss("there");
  21.  
  22. cout << s1.at(ss) << endl;
  23.  
  24. s1="12 x 34";
  25. cout << "'" << s1 << "'" << endl;
  26. junk(s1.at("x"));
  27. cout << "'" << s1 << "'" << endl;
  28. s1="ab 12 cd";
  29.  
  30. cout << "'" << s1 << "'" << endl;
  31.  
  32. cout << "'" << (s1.at("12") += "34") << "'" << endl;
  33. cout << "'" << s1 << "'" << endl;
  34.  
  35. s1="12 y 34";
  36. cout << "'" << s1 << "'" << endl;
  37. cout << "'" << s1.at("y").append("z").prepend("x").insert(0,"w") << "'" << endl;
  38. cout << "'" << s1 << "'" << endl;
  39.  
  40. s1="hello XXX world";
  41. cout << "'" << s1 << "'" << endl;
  42. cout << "Enter word:";
  43. cin >> s1.substr(6,3) ;  // input from standard input to substring XXX
  44. cout << "'" << s1 << "'" << endl; 
  45.  
  46. //cout << "Number of tests that passed ==> " << num_pass << endl;
  47. //cout << "Number of tests that failed ==> " << num_fail << endl;
  48. }
  49.